import java.util.ArrayList;
import java.util.Scanner;

public class NumericalCalculation {
    public static void main(String[] args) {
        ArrayList<Integer> integers = new ArrayList<Integer>();
        Scanner scanner = new Scanner(System.in);
        String[] split = scanner.nextLine().split(",");


        for(int i = 0;i<split.length;i++){
            integers.add(Integer.parseInt(split[i]));
        }

        int ans = 0;

        for(int i=0;i<integers.size();i++){
            for (int j=0;j<integers.size();j++){
                if(i<j){
                    int sum = 0;
                    for(int k=i;k<=j;k++){
                        sum += integers.get(k);
                    }
                    ans = Math.max(ans,sum);
                }
            }
        }
        System.out.println(ans);

    }
}
